import api from './index'
import { axios } from '@/utils/request'

// umsRoleUrl: '/api-ums/ums/umsRole/'

/**
 * 路由
 * // ums
    {
        path: '/ums',
        name: 'ums',
        component: PageView,
        redirect: '/ums/umsRole',
        meta: { title: '后台用户角色表', icon: 'table', permission: [ 'ums' ] },
        children: [
          {
            path: '/ums/umsRole',
            name: 'UmsRole',
            component: () => import('@/views/ums/UmsRoleList'),
            meta: { title: '后台用户角色表', keepAlive: true, permission: [ 'ums_umsRole' ] }
          }
        ]
      },
 */

/**
 * 查询列表
 * @returns {*}
 */
export function getList (parameter) {
    return axios({
        url: api.umsRoleUrl,
        method: 'get',
        data: parameter
    })
}

/**
 * 查询详情
 * @param id
 * @returns {*}
 */
export function getUmsRole (id) {
    return axios({
        url: api.umsRoleUrl + id,
        method: 'get'
    })
}

/**
 * 更新
 * @param id
 * @param parameter
 * @returns {*}
 */
export function updateUmsRole (id, parameter) {
    return axios({
        url: api.umsRoleUrl + id,
        method: 'post',
        data: parameter
    })
}

/**
 * 新增
 * @param parameter
 * @returns {*}
 */
export function addUmsRole (parameter) {
    return axios({
        url: api.umsRoleUrl,
        method: 'put',
        data: parameter
    })
}

/**
 * 删除
 * @param id
 * @returns {*}
 */
export function deleteUmsRole (id) {
    return axios({
        url: api.umsRoleUrl + id,
        method: 'delete'
    })
}

/**
 * 批量删除
 * @param id
 * @returns {*}
 */
export function batchDeleteUmsRole (parameter) {
    return axios({
        url: api.umsRoleUrl + 'delete/batch',
        method: 'post',
        data: parameter
    })
}
